package com.gitee.wsl.ext.collection


/**
 * Groups this `Traversable` into fixed size blocks.
 *
 *
 * Let length be the length of this Iterable. Then grouped is defined as follows:
 *
 *  * If `this.isEmpty()`, the resulting `Iterator` is empty.
 *  * If `size <= length`, the resulting `Iterator` will contain `length / size` blocks of size
 * `size` and maybe a non-empty block of size `length % size`, if there are remaining elements.
 *  * If `size > length`, the resulting `Iterator` will contain one block of size `length`.
 *
 * Examples:
 * <pre>
 * `
 * [].grouped(1) = []
 * [].grouped(0) throws
 * [].grouped(-1) throws
 * [1,2,3,4].grouped(2) = [[1,2],[3,4]]
 * [1,2,3,4,5].grouped(2) = [[1,2],[3,4],[5]]
 * [1,2,3,4].grouped(5) = [[1,2,3,4]]
` *
</pre> *
 *
 * Please note that `grouped(int)` is a special case of [.sliding], i.e.
 * `grouped(size)` is the same as `sliding(size, size)`.
 *
 * @param size a positive block size
 * @return A new Iterator of grouped blocks of the given size
 * @throws IllegalArgumentException if `size` is negative or zero
 */
//fun<T> Iterable<T>.grouped(size: Int): List<List<T>>{
//
//}